import request from "../../utils/request"
const getLeaveList=()=>{
    return request({
        url:"/leave/list",
        method:"get"
    })
}

const addLeave=(data:any)=>{
    return request({
        url:"/leave/add",
        method:"post",
        data
        
    })
}

const pendLeave=()=>{
    //获取请假待审批列表
    return request({
        url:"/leave/pending",
        method:"get",
    })
}

const deleteLeave=(id:any)=>{
    //删除请假
    return request({
        url:"/leave/delete/"+id,
        method:"get",
    })
}

const getLeaveById=(id:any)=>{
    //根据id获取请假信息
    return request({
        url:"/leave/person/"+id,
        method:"get",
    })
}

const updateLeave=(data:any)=>{
    //更新请假
    return request({
        url:"/leave/update",
        method:"post",
        data
    })
}

export {
    getLeaveList,
    addLeave,
    pendLeave,
    deleteLeave,
    getLeaveById,
    updateLeave
}